using JTZY.Model.Business;
using System.Data.Common;
using System.Runtime.CompilerServices;

namespace JTZY.Model.Order
{
    /// <summary>
    /// 订单表
    /// </summary>
    [SugarTable("corecmsorder")]
    public class Corecmsorder
    {
        /// <summary>
        /// 订单号 
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
        public string OrderId { get; set; }

        /// <summary>
        /// 商品总价 
        /// </summary>
        public decimal GoodsAmount { get; set; }

        /// <summary>
        /// 已支付的金额 
        /// </summary>
        public decimal PayedAmount { get; set; }

        /// <summary>
        /// 订单实际销售总额 
        /// </summary>
        public decimal OrderAmount { get; set; }

        /// <summary>
        /// 支付状态 
        /// </summary>
        public int PayStatus { get; set; }

        /// <summary>
        /// 发货状态 
        /// </summary>
        public int ShipStatus { get; set; }

        /// <summary>
        /// 订单状态 
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 订单类型 
        /// </summary>
        public int OrderType { get; set; }

        /// <summary>
        /// 配送方式 
        /// </summary>
        public int ReceiptType { get; set; }

        /// <summary>
        /// 支付方式代码 
        /// </summary>
        public string PaymentCode { get; set; }

        /// <summary>
        /// 支付时间 
        /// </summary>
        public DateTime? PaymentTime { get; set; }

        /// <summary>
        /// 配送方式ID 关联ship.id 
        /// </summary>
        public int LogisticsId { get; set; }

        /// <summary>
        /// 配送方式名称 
        /// </summary>
        public string LogisticsName { get; set; }

        /// <summary>
        /// 配送费用 
        /// </summary>
        public decimal CostFreight { get; set; }

        /// <summary>
        /// 用户ID 关联user.id 
        /// </summary>
        public int UserId { get; set; }

        /// <summary>
        /// 店铺ID 关联seller.id 
        /// </summary>
        public int SellerId { get; set; }

        /// <summary>
        /// 售后状态 
        /// </summary>
        public int ConfirmStatus { get; set; }

        /// <summary>
        /// 确认收货时间 
        /// </summary>
        public DateTime? ConfirmTime { get; set; }

        /// <summary>
        /// 自提门店ID，0就是不门店自提 
        /// </summary>
        public int StoreId { get; set; }

        /// <summary>
        /// 收货地区ID 
        /// </summary>
        public int ShipAreaId { get; set; }

        /// <summary>
        /// 收货详细地址 
        /// </summary>
        public string ShipAddress { get; set; }

        /// <summary>
        /// 收货人姓名 
        /// </summary>
        public string ShipName { get; set; }

        /// <summary>
        /// 收货电话 
        /// </summary>
        public string ShipMobile { get; set; }

        /// <summary>
        /// 商品总重量 
        /// </summary>
        public decimal Weight { get; set; }

        /// <summary>
        /// 开发票 
        /// </summary>
        public int TaxType { get; set; }

        /// <summary>
        /// 税号 
        /// </summary>
        public string TaxCode { get; set; }

        /// <summary>
        /// 发票抬头 
        /// </summary>
        public string TaxTitle { get; set; }

        /// <summary>
        /// 使用积分 
        /// </summary>
        public int Point { get; set; }

        /// <summary>
        /// 积分抵扣金额 
        /// </summary>
        public decimal PointMoney { get; set; }

        /// <summary>
        /// 订单优惠金额 
        /// </summary>
        public decimal OrderDiscountAmount { get; set; }

        /// <summary>
        /// 商品优惠金额 
        /// </summary>
        public decimal GoodsDiscountAmount { get; set; }

        /// <summary>
        /// 优惠券优惠额度 
        /// </summary>
        public decimal CouponDiscountAmount { get; set; }

        /// <summary>
        /// 优惠券信息 
        /// </summary>
        public string Coupon { get; set; }

        /// <summary>
        /// 优惠信息 
        /// </summary>
        public string PromotionList { get; set; }

        /// <summary>
        /// 买家备注 
        /// </summary>
        public string Memo { get; set; }

        /// <summary>
        /// 下单IP 
        /// </summary>
        public string Ip { get; set; }

        /// <summary>
        /// 卖家备注 
        /// </summary>
        public string Mark { get; set; }

        /// <summary>
        /// 订单来源 
        /// </summary>
        public int Source { get; set; }

        /// <summary>
        /// 场景值 
        /// </summary>
        public int Scene { get; set; }

        /// <summary>
        /// 是否评论 
        /// </summary>
        public bool IsComment { get; set; }

        /// <summary>
        /// 删除标志 
        /// </summary>
        public bool Isdel { get; set; }

        /// <summary>
        /// 关联营销类型对象序列 
        /// </summary>
        public int ObjectId { get; set; }

        /// <summary>
        /// 创建时间 
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 更新时间 
        /// </summary>
        public DateTime? UpdateTime { get; set; }
        /// <summary>
        /// 发货时间
        /// </summary>
        public DateTime? SendTime { get; set; }
        /// <summary>
        /// 代理配送方式
        /// </summary>
        public string DeliveryType { get; set; }
        /// <summary>
        /// 收货时间
        /// </summary>
        public DateTime? ReceiveTime { get; set; }
        /// <summary>
        /// 1 小仓订单
        /// </summary>
        public int IsMini { get; set; }

        [Navigate(NavigateType.OneToMany, nameof(Corecmsorderitem.OrderId), nameof(OrderId))] //自定义关系映射
        public List<Corecmsorderitem> CorecmsorderitemNav { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<Orderdetail> OrderdetailNav { get; set; }

        #region 关联字段
        [SugarColumn(IsIgnore =true)]
        public string UserName { get; set; }
        /// <summary>
        ///     订单详情
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<Corecmsorderitem> items { get; set; }

        /// <summary>
        ///     是否能发起售后
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool addAftersalesStatus { get; set; } = false;
        /// <summary>
        ///     已经退过款的金额
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public decimal refunded { get; set; } = 0;
        /// <summary>
        ///     售后单号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string BillAftersalesId { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<Corecmsbillaftersales> aftersalesItem { get; set; }
        /// <summary>
        /// 已售后明细
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<Billaftersaledetail> afterSaleDetails { get; set; } = new();

        /// <summary>
        /// 是否重打印
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool Reprint { get; set; }

        #endregion
    }
}